nettechfandomcom-20200213-history
YouTube
YouTube is a social video-sharing website hosting millions of videos, with advanced features like subtitles and annotations, video commenting and more. Video Formats Videos are usually available in multiple formats, as specified by a numeric format id (fmt). Downloading a video There are multiple methods used to gather the video's download URL. Most methods contain tokens which are tied to a specific IP address and expire after a short amount of time. Method 1 # Get the VIDEO ID # Navigate to http://www.youtube.com/watch?v= and your VIDEO ID. # View the source code and extact the "t" value from inside SWF_ARGS # Copy that t value (without quotes) and paste after http://www.youtube.com/get_video?video_id=VIDEO_ID&t= Method 2 #Get the VIDEO ID #Navigate to http://www.youtube.com/get_video_info?video_id and your VIDEO ID. #Split the & key = value string up to find "fmt_url_map", then deocode the URL escaped characters. #Split the string by commas, then find the format you like (the first two numbers in each of the results). #Split by the | character and use the second returned string as the video URL. Video Annotations YouTube recently introduced annotations, allowing users to create 'links' and other pop-up text in the flash YouTube player. Unfortunatley, as they rely on the flash player you cannot see them when you download it. But, in any case, the syntax for viewing the XML file where the flash player gets the info of what annotations to put where and when is stored at: http://www.google.com/reviews/y/read2?video_id= where obviously you must replace "" with the actual video id. Just a note of warning to those trying to do stuff with it, the server may return it in a gzip compressed format, so watch out if so. I personally don't know much about the format of the files, so if anyone would like to contribute that, it would be appreciated. Video Subtitles YouTube finally released support for subtitles, and of course, they did it in a nice way for us to use... not really. Firstly, we have to get the list of subtitles to determine what language the subtitles are in, and what they called them. So open up the url: http://video.google.com/timedtext?hl=en&v=&ts=&type=list&tlangs=1 where you put in your video id. The ts value, i'm not quite sure how to get it or what it does - but you can safely leave it empty for now. This URL should return an XML file with as the root element and all the languages YouTube supports. In this file, all subtitle tracks have a self-closing tag with the attributes: *id - the subtitle track id *name - the name of the subtitle track *lang_code - the language ISO 639-21 code of the track *lang_original - the name of the language in that language (WARNING! many languages will contain non-ascii text) *lang_translated - the name of the language in your language (NOTE: your language is set by the hl parameter in the url. Changing this will translate these to that language and change the default language returned) *cantran - true/false - if the track can be translated by the automatic translation engine or not Using these attributes of your selected track, you can get the subtitles in TimedText XML format by going now to the url: http://video.google.com/timedtext?hl=en&v=&ts=&type=track&name=&lang= where name and lang_code are url escaped versions of the attributes above. To translate the subtitles to another language, add "&tlang=" and the ISO code of the language to be translated to. More See http://adamswiki.wik.is/YouTube for more... (this will eventually be copied over here) Category:Videos